import java.io.IOException;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/10/13
 * Time: 9:06
 * Description:
 */
public class TestDemo {


    public static void main(String[] args) {
        int a = 18;
        int b = 24;
        int c = a%b;//18%24=18
        while (c!=0){
            a = b;//24
            b = c;//18
            c = a%b;//6
        }
        System.out.println(b);
    }


    public static void main28(String[] args) {
        int a = 24;
        int b = 18;
        int c = a%b;//24%18=6
        while (c!=0){
            a = b;//18
            b = c;//6
            c = a%b;//0
        }
        System.out.println(b);
    }


    public static void main27(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i ; j++) {
                System.out.print(i+"*"+j +"=" +i*j+" ");
            }
            System.out.println();
        }
    }

    public static void main26(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for(int j = 2;j <= n;j++) {

            int i = 2;
            for (; i <= Math.sqrt(j); i++) {
                if (j % i == 0) {
                    //System.out.println("不是素数！");
                    break;
                }
            }
            if (i > Math.sqrt(j)) {
                System.out.println(j+ " 是素数");
            }
        }

    }

    public static void main25(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int i = 2;
        for (; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if (i > Math.sqrt(n)) {
            System.out.println("是素数");
        }
    }

    public static void main24(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int i = 2;
        for (; i <= n/2; i++) {
            if(n % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if(i > n/2) {
            System.out.println("是素数");
        }
    }

    public static void main23(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        if(n==1) {
            System.out.println("1不是素数");
            return;
        }
        //2-  n-1
        int i = 2;
        for (; i < n; i++) {
            if(n % i == 0) {
                System.out.println("不是素数！");
                //break;
                return;
            }
        }
        if(n == i ) {
            System.out.println("是素数！");
        }
    }

    public static void main22(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //2-  n-1
        int i = 2;
        for (; i < n; i++) {
            if(n % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if(i==n) {
            System.out.println("是素数");
        }
    }

    public static void main21(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int age = scan.nextInt();
            if (age < 18) {
                System.out.println("少年！");
            } else if (age <= 28) {
                System.out.println("青年！");
            } else if (age <= 55) {
                System.out.println("中年！");
            } else {
                System.out.println("老年");
            }
        }
    }


    public static void main18(String[] args) {
        Random random = new Random(56789);
        int randNum = random.nextInt(100)+1;//[1,101)
        Scanner scan = new Scanner(System.in);
        while (true) {
            System.out.println("请输入你要猜的数字[1-100]：");
            int num = scan.nextInt();
            if(num < randNum) {
                System.out.println("低了！");
            }else if(num == randNum) {
                System.out.println("找到了！");
                break;//非常重要！
            }else {
                System.out.println("高了！");
            }
        }
    }


    /**
     * 循环输入
     * @param args
     */
    public static void main17(String[] args) {
        Scanner scan = new Scanner(System.in);


        //ctr+d
        while(scan.hasNextInt()) {
            int n = scan.nextInt();
            int a1 = scan.nextInt();
            int a2 = scan.nextInt();
            int a3 = scan.nextInt();
            System.out.println(n+10);
        }

    }


    public static void main16(String[] args) {
        Scanner scan = new Scanner(System.in);

        System.out.println("请输入姓名：");
        String name = scan.nextLine();
        System.out.println("姓名："+name);

        int a = scan.nextInt();
        System.out.println("这是一个整数："+a);


    }


    /**
     * 不会使用它
     * @param args
     * @throws IOException
     */
    public static void main15(String[] args) throws IOException {
        System.out.print("Enter a Char:");
        char i = (char) System.in.read();//alt+enter
        System.out.println("your char is :"+i);
    }


    public static void main14(String[] args) {
        System.out.println("换行");
        System.out.print("不换行");
        System.out.printf("%d\n",10);
    }


    public static void main13(String[] args) {
        int i = 0;
        do {
            System.out.println("haha");
        }while (i!=0);
    }


    public static void main12(String[] args) {
        int sum = 0;
        for (int j = 1; j <= 5 ; j++) {
            int ret = 1;
            for (int i = 1; i <= j ; i++) {
                ret = ret*i;
            }
            sum += ret;
            //System.out.println(ret);
        }
        System.out.println(sum);

    }


    public static void main11(String[] args) {
        int ret = 1;
        for (int i = 1; i <= 5 ; i++) {
            ret = ret*i;
        }
        System.out.println(ret);
    }

    public static void main10(String[] args) {
        int sum = 0;
        for(int i = 1;i <= 100;i++) {
            sum += i;
        }
        System.out.println(sum);
    }

    public static void main9(String[] args) {
        //找到1-100之间  既能被3整除的也能被5整除的数字
        int i = 1;
        while (i <= 100){
            if(i % 15 != 0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }

    public static void main8(String[] args) {
        int i = 1;
        while(i <= 10) {
            if(i % 3 != 0) {
                i++;
                continue;
                //System.out.println();
            }
            System.out.println(i);
            i++;
        }
    }

    public static void main7(String[] args) {
        int i = 1;
        while(i <= 10) {
            if(i % 3 == 0) {
                System.out.println(i);
                break;
            }
            i++;
        }
    }

    public static void main6(String[] args) {
        int i = 10;
        while(i <= 100) {
            System.out.println(i);
            i++;
        }
    }

    public static void main5(String[] args) {

        int j = 1;
        int n = 5;
        int sum = 0;
        while(j <= n) {
            int i = 1;
            int ret = 1;
            while (i <= j) {
                ret = ret * i;
                i++;
            }
            sum = sum+ret;
            j++;
        }
        System.out.println(sum);
    }

    //5! = 5*4*3*2*1 -> 1*2*3*4*5
    //n!
    public static void main4(String[] args) {
        int i = 1;
        int n = 5;
        int ret = 1;
        while (i <= n) {
            ret = ret * i;
            i++;
        }
        System.out.println(ret);
    }
    //1-100奇数的和   1-100偶数的和
    public static void main3(String[] args) {
        int i = 1;
        int sum = 0;
        while (i <= 100) {
            sum = sum+i;
            i++;
        }
        System.out.println("总数："+sum);
        i = 1;
        int sumOdd = 0;
        while (i <= 100) {
            sumOdd = sumOdd+i;
            i += 2;
        }
        System.out.println("奇数："+sumOdd);

        i = 2;
        int sumEVE = 0;
        while (i <= 100) {
            sumEVE = sumEVE+i;
            i += 2;
        }
        System.out.println("偶数："+sumEVE);

    }

    public static void main2(String[] args) {
        while (true) {
            System.out.println("fsfsafsa");
        }
    }
    public static void main1(String[] args) {
        int i = 1;
        while(i <= 10) {
            System.out.println(i);
            i = i+1;
        }
    }
}
